package com.ljye.jg.ljye.activity;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.gitonway.lee.niftymodaldialogeffects.lib.NiftyDialogBuilder;
import com.ljye.jg.ljye.R;

//我要开课
public class Actvivty_School_Begins extends Activity {
    private ImageView back;//返回
    private TextView Consultation;//咨询
    private LinearLayout authentication;//实名认证
    private LinearLayout data;//个人资料
    private LinearLayout time;//授课时间
    private LinearLayout rule;//平台规则
    private Button submit;//申请面试

    private Intent intent;
    public View.OnClickListener listener = new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            switch (view.getId()) {
                case R.id.Consultation://咨询
                    final NiftyDialogBuilder dialogBuilder = NiftyDialogBuilder.getInstance(Actvivty_School_Begins.this);
                    dialogBuilder
                            .withTitle("咨询电话")
                            .withDialogColor("#11B6F4")
                            .withMessage("4000-999-027")
                            .withMessageColor("#FFFFFF")
//                    .withIcon(getResources().getDrawable(R.drawable.))
                            .withDuration(1)
                            .withButton1Text("呼叫")
                            .withButton2Text("取消")
                            .isCancelableOnTouchOutside(true)
                            .setButton1Click(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + "4000999027"));
                                    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                                    startActivity(intent);
                                }
                            })
                            .setButton2Click(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    dialogBuilder.dismiss();
                                }
                            })
                            .show();
                    break;
                case R.id.back://返回
                    finish();
                    break;
                case R.id.authentication://实名认证
                    intent = new Intent(Actvivty_School_Begins.this, Activity_Certification.class);
                    startActivity(intent);
                    break;
                case R.id.data://个人中心
                    intent = new Intent(Actvivty_School_Begins.this, Activity_Personal_Data.class);
                    startActivity(intent);
                    break;
                case R.id.time://授课时间
                    intent = new Intent(Actvivty_School_Begins.this, Activity_teaching_time.class);
                    startActivity(intent);
                    break;
                case R.id.rule://平台规则
                    intent = new Intent(Actvivty_School_Begins.this, Activity_Platform_Rules.class);
                    startActivity(intent);
                    break;
                case R.id.submit://提交
                    Toast.makeText(Actvivty_School_Begins.this, "提交申请", Toast.LENGTH_SHORT).show();
                    break;
                default:
                    break;
            }
        }
    };

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.actvivty_school_begins);
        //初始化控件
        initView();
        Consultation.setOnClickListener(listener);//咨询
        back.setOnClickListener(listener);//返回
        authentication.setOnClickListener(listener);//实名认证
        data.setOnClickListener(listener);//个人资料
        time.setOnClickListener(listener);//授课时间
        rule.setOnClickListener(listener);//平台规则
        submit.setOnClickListener(listener);//提交申请
        //提交申请 能否被点击
        submit.setEnabled(false);
    }

    //找控件
    private void initView() {
        back = (ImageView) findViewById(R.id.back);
        Consultation = (TextView) findViewById(R.id.Consultation);
        authentication = (LinearLayout) findViewById(R.id.authentication);
        data = (LinearLayout) findViewById(R.id.data);
        time = (LinearLayout) findViewById(R.id.time);
        rule = (LinearLayout) findViewById(R.id.rule);
        submit = (Button) findViewById(R.id.submit);
        time = (LinearLayout) findViewById(R.id.time);
    }


}

